<%- unless @filters.blank? && (@pseuds.size < 1 || (@user && @pseuds.size < 2)) -%>
<%- form_tag(works_path, :class => 'work-filters', :method => :get) do -%>
  <%- field_set_tag 'Filter these results: '.t do -%>
 		<dl class="filters">
			<%- unless (@pseuds.size < 1 || (@user && @pseuds.size < 2)) -%>
        <dt onclick='toggleFilters("filter-pseuds")'>
          <span id="filter-pseuds_closed" style="display: none;"><%= image_tag 'arrow-right.gif', :alt => "" -%></span>
          <span id="filter-pseuds_open"><%= image_tag 'arrow-down.gif', :alt => "" -%></span>              
          Pseud
        </dt>
        <dd id="filter-pseuds" class="tags">
          <ul>
            <%- for pseud in @pseuds.sort -%>
              <%- if pseud.works.count > 0 -%>
                <li>
                  <%= check_box_tag 'selected_pseuds[]', pseud.id, @selected_pseuds.include?(pseud), :id => "selected_pseuds_#{pseud.id}" %>
                  <%= label_tag "selected_pseuds_#{pseud.id}", pseud.name %>  
                </li>
              <%- end -%>
            <%- end -%> 
          </ul>
        </dd>			
			<%- end -%>
			<%- unless @filters.blank? -%>
			  <%- Tag::FILTERS.each do |type| -%>
				  <%- unless @filters[type].blank? -%>
          <dt onclick='toggleFilters("tag_category_<%= type %>");'>
            <span id="tag_category_<%= type %>_closed" style="display: none;"><%= image_tag 'arrow-right.gif', :alt => "" -%></span>
            <span id="tag_category_<%= type %>_open"><%= image_tag 'arrow-down.gif', :alt => ""-%></span>              
            <%= type.constantize::NAME %> 
          </dt>
          <dd id="tag_category_<%= type %>" class="tags">
            <ul>              
              <%- @filters[type].each do |tag_info| -%>
                <li>
                  <%= check_box_tag "selected_tags[]", tag_info[:id], @selected_tags.include?(tag_info[:id]), :id => "selected_tags_#{tag_info[:id]}" -%>
                  <%= label_tag "selected_tags_#{tag_info[:id]}", "#{tag_info[:name]} (#{tag_info[:count]})" %>  
                </li>
              <%- end -%> 
           </ul>
          </dd>
					<%- end -%>
        <%- end -%>         
      <%- end -%>
		</dl>
		<p>
  		<%= hidden_field_tag("tag_id", @tag.name) if @tag %>
  		<%= hidden_field_tag("query", @query) if @query %>
  		<%= hidden_field_tag("fandom_id", @fandom.id) if @fandom %>
  		<%= hidden_field_tag("user_id", @user.login) if @user %>
		</p>
		<p class="submit"><%= submit_tag "Filter Works".t %></p>
  <%- end -%>
  <%- end -%>
<%- end -%>
